package xmlService;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import beans.OrdenDeCompraBean;
import beans.RemitoBean;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;

public class RemitoXmlService {

	public static void  guardarRemito(RemitoBean c)
	{
		
		XStream xstream = new XStream( new DomDriver());
		xstream.autodetectAnnotations(true);  
		
		xstream.alias("Remito", RemitoBean.class);

		FileOutputStream fos;
		try {
			fos = new FileOutputStream("src/XML/remito"+c.getNumero()+".xml");
			String s = xstream.toXML(c);
			fos.write(s.getBytes());
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
				
	}
	
}
